﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Control.Bus;

namespace QuanLyKho
{
    public partial class FrmBaoCaoNhap : Form
    {
        public FrmBaoCaoNhap()
        {
            InitializeComponent();
        }
        public FrmBaoCaoNhap(string ProdCode,DateTime fromDate,DateTime toDate)
        {
            InitializeComponent();
            dateTimePicker1.Value = fromDate;
            dateTimePicker2.Value = toDate;
            textBox1.Text = ProdCode;

            BindingSource();
        }

        private void BindingSource()
        {
            string ProdCode = textBox1.Text;
            DateTime fromDate = dateTimePicker1.Value;
            DateTime toDate = dateTimePicker2.Value;
            dataGridView1.AutoGenerateColumns = false;
            List<BusImportBillDetail> billdetails = new List<BusImportBillDetail>();
            billdetails = BusImportBillDetail.Find(ProdCode, fromDate, toDate);
            dataGridView1.DataSource = null;
            dataGridView1.DataSource = billdetails;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            BindingSource();
        }
    }
}
